home *** CD-ROM | disk | FTP | other *** search
- #include "crtlocal.h"
- #include <Dialogs.h>
- #include <OSUtils.h>
- #include <Resources.h>
-
- #ifdef THINK_C
- #include <LoMem.h>
- #define can CurApName
- #else
- #include <SysEqu.h>
- #define can (char *)CurApName
- #endif
-
- enum {
- cmdLine = 3, labelLine, execute
- };
-
- static struct {
- short count;
- struct {
- Handle h;
- Rect box;
- char kind;
- } item[13];
- } itemList = { 5,
-
- /* OK */
- 0, { 76, 100, 96, 160 }, ctrlItem+btnCtrl,
-
- /* Cancel */
- 0, { 76, 210, 96, 270 }, ctrlItem+btnCtrl,
-
- /* command line */
- 0, { 41, 34, 57, 376 }, editText+itemDisable,
-
- /* "Command Line:" */
- 0, { 14, 20, 30, 170 }, statText+itemDisable,
-
- /* Execute */
- 0, { 76, 320, 96, 380 }, ctrlItem+btnCtrl,
-
- };
-
- /*
- * ditem - return item handle
- *
- */
-
- static DialogPtr dp;
-
- static Handle ditem(int);
-
- static Handle ditem(int i)
- {
- short kind;
- Handle item;
- Rect box;
-
- GetDItem(dp, i, &kind, &item, &box);
- return(item);
- }
-
- #if 0
-
- enum { NARGS = 255};
-
- static int argc;
- static Str255 argbuf;
- static char *argvec[NARGS+1];
-
- static void parse(char *s, char *t)
- {
- int c = *s++, quote = 0;
- argc = 0;
- s[(unsigned char)c] = 0;
- while (c = *s++) {
- if (c == ' ')
- continue;
- if (argc < NARGS)
- argvec[argc++] = t;
- do {
- if (c == '\\' && *s)
- c = *s++;
- else if (c == '"' || c == '\'') {
- if (!quote) {
- quote = c;
- continue;
- }
- if (c == quote) {
- quote = 0;
- continue;
- }
- }
- *t++ = c;
- } while (*s && ((c = *s++) != ' ' || quote));
- *t++ = 0;
- }
- argvec[argc] = 0;
- }
-
- #endif
-
- #ifdef THINK_C
- /* avoid dragging in macTraps */
- #pragma parameter __A0 myPtrToHand(__A0,__D0)
- pascal Handle myPtrToHand(const void *srcPtr, long size) = 0xA9E3;
- #endif
-
- #include <Aliases.h>
-
- void BeginProcessing(void)
- {
- }
-
- void EndProcessing(void)
- {
- }
-
- #if 0
- void crt_getargs(void)
- {
- short i;
- Rect bounds = { 60, 51, 170, 461 };
- Handle items;
- #ifdef THINK_C
- /* avoid dragging in macTraps */
- items = myPtrToHand(&itemList,sizeof(itemList));
- #else
- i = PtrToHand(&itemList, &items, sizeof(itemList));
- #endif
- dp = NewDialog(0, &bounds, (unsigned char *)"\006 line", 0, 1, (WindowPtr) -1, 0, 0, items);
- SetCTitle((ControlHandle)ditem(ok), (unsigned char *)"\003OK");
- SetCTitle((ControlHandle)ditem(cancel), (unsigned char *)"\006Cancel");
- SetCTitle((ControlHandle)ditem(execute), (unsigned char *)"\007Execute");
- SetIText(ditem(labelLine), (unsigned char *)"\015Command Line:");
- SetIText(ditem(cmdLine), (unsigned char *)"\000" );
- SelIText(dp, cmdLine, 9999, 9999);
- ShowWindow(dp);
- SetCursor(&qd.arrow);
- do {
- ModalDialog(0, &i);
- if (i == ok) GetIText(ditem(cmdLine), (void *)argbuf);
- }
- while ((i != ok) && (i != cancel) && (i != execute));
- if (i == execute)
- {
- GetIText(ditem(cmdLine), (void *)argbuf);
- DisposDialog(dp);
- BeginProcessing();
- EndProcessing();
- }
- else DisposDialog(dp);
- }
- #endif
-
- void scanfolder(FSSpec *curDocFSS)
- {
- CInfoPBRec curDocPB;
- int i;
- FSSpec new;
- OSErr err;
- OSErr iErr;
- curDocPB.hFileInfo.ioVRefNum = curDocFSS->vRefNum;
- curDocPB.hFileInfo.ioDirID = curDocFSS->parID;
- curDocPB.hFileInfo.ioNamePtr = curDocFSS->name;
- curDocPB.hFileInfo.ioFDirIndex = 0;
- err = PBGetCatInfoSync (&curDocPB);
- new.parID = curDocPB.hFileInfo.ioDirID;
- new.vRefNum = curDocFSS->vRefNum;
- for (i = 1; err != fnfErr; i++)
- {
- curDocPB.hFileInfo.ioVRefNum = new.vRefNum;
- curDocPB.hFileInfo.ioDirID = new.parID;
- curDocPB.hFileInfo.ioNamePtr = new.name;
- curDocPB.hFileInfo.ioFDirIndex = i;
- err = PBGetCatInfoSync (&curDocPB);
- if (err == noErr)
- {
- Boolean isFolder,wasAlias;
- err = ResolveAliasFile (&new, true, &isFolder, &wasAlias);
- if (err == noErr)
- {
- if (isFolder) scanfolder(&new);
- else ProcessDoc (&new);
- }
- }
- }
- }
-